package com.dr.cmdb.core.service.impl;

import com.dr.cmdb.core.domain.Model;
import com.dr.cmdb.core.dto.ModelPropertyDto;
import com.dr.cmdb.core.mapper.ModelMapper;
import com.dr.cmdb.core.mapper.ModelPropertyMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;

import com.dr.cmdb.core.service.ModelService;

import java.util.List;

/**
      * @ProjectName:    cmdb
      * @Package:        com.dr.cmdb.application.service
      * @Description:     java类作用描述 
      * @Author:            duanrui
      * @CreateDate:     2021/3/16 19:42
      * @Version:        1.0
      * 
Copyright: Copyright (c) 2021

* */
@Service
public class ModelServiceImpl implements ModelService{

    @Resource
    private ModelMapper modelMapper;


    @Resource
    private ModelPropertyMapper modelPropertyMapper;

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return modelMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insertSelective(Model record) {
        return modelMapper.insertSelective(record);
    }

    @Override
    public Model selectByPrimaryKey(Integer id) {
        return modelMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Model record) {
        return modelMapper.updateByPrimaryKeySelective(record);
    }

    /**
     * 获取表字段
     *
     * @param modelCode
     * @return
     */
    @Override
    public List<ModelPropertyDto> getModelProperties(String modelCode) {
        return modelPropertyMapper.selectByModelCode(modelCode);
    }
}
